*******************************************	   
************* TABLE A34 FR Autocorrelation test
*******************************************	   

clear all
clear matrix
set more off

* Data 
use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/panel_excombatientes.dta", clear 

keep if Latitude!=. & Longitude!=.

eststo clear
set more off

acreg diffcaptures_f gold_shock_r mean_gold_shock_r c.time_t age female black indigenous, id(id) time(year) spatial latitude(Latitude) longitude(Longitude) dist(50) pfe1(wartimenetwork) pfe2(origmun)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
estadd local MT = "$\checkmark$"
estadd local BC = "$\checkmark$"
estadd local CO = "$\checkmark$"
summ diffcaptures_f if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

acreg diffcaptures_f gold_shock_r mean_gold_shock_r c.time_t age female black indigenous, id(id) time(year) spatial latitude(Latitude) longitude(Longitude) dist(100) pfe1(wartimenetwork) pfe2(origmun)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
estadd local MT = "$\checkmark$"
estadd local BC = "$\checkmark$"
estadd local CO = "$\checkmark$"
summ diffcaptures_f if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

acreg diffcaptures_f gold_shock_r mean_gold_shock_r c.time_t age female black indigenous, id(id) time(year) spatial latitude(Latitude) longitude(Longitude) dist(150) pfe1(wartimenetwork) pfe2(origmun)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
estadd local MT = "$\checkmark$"
estadd local BC = "$\checkmark$"
estadd local CO = "$\checkmark$"
summ diffcaptures_f if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

acreg diffcaptures_f gold_shock_r mean_gold_shock_r c.time_t age female black indigenous, id(id) time(year) spatial latitude(Latitude) longitude(Longitude) dist(200) pfe1(wartimenetwork) pfe2(origmun)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
estadd local MT = "$\checkmark$"
estadd local BC = "$\checkmark$"
estadd local CO = "$\checkmark$"
summ diffcaptures_f if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

// esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA13_panelA.tex", se ///
// 	   star(* 0.10 ** 0.05 *** 0.01 ) ///
// 	   stats(meanDep SDDep N ALLFE TT MT BC CO, fmt(%12.4fc %12.4fc  %12.0fc %12.0fc %12.0fc %12.0fc  %12.0fc ) ///
// 	   label("\small Mean of Outcome" "\small S.D of Outcome" "\small Observations" "\small Municipality, Year, and Group FE" "\small Time Trends" "\small Region $\times$ Year"  ///
// 	   "\small Municipality Characteristics TT" "\small Individual Covariates" )) ///
// 	   keep (gold_shock_r mean_gold_shock_r) 
// 	   varlabels(gold_shock_r "Economic Shock" mean_gold_shock_r "Average Group Shock" ) ///
// 	   ti("Main Results with Auto-correlation Tests") ///	  
// 	   replace 

* Table A34
	   esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA34.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep SDDep N ALLFE TT MT BC CO, fmt(%12.4fc %12.4fc  %12.0fc %12.0fc %12.0fc %12.0fc  %12.0fc ) ///
	   label("\small Mean of Outcome" "\small S.D of Outcome" "\small Observations" "\small Municipality, Year, and Group FE" "\small Time Trends" "\small Region $\times$ Year"  ///
	   "\small Municipality Characteristics TT" "\small Individual Covariates" )) ///
	   varlabels(gold_shock_r "Economic Shock" mean_gold_shock_r "Average Group Shock" ) ///
	   ti("Main Results with Auto-correlation Tests") ///	  
	   replace 
	  
/*	  
eststo clear
set more off

acreg diffcaptures_f gold_shock_r mean_gold_shock_r c.time_t, id(id) time(year) spatial latitude(Latitude) longitude(Longitude) dist(50) pfe1(wartimenetwork) pfe2(origmun)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo

acreg diffcaptures_f gold_shock_r mean_gold_shock_r c.time_t, id(id) time(year) spatial latitude(Latitude) longitude(Longitude) dist(100) pfe1(wartimenetwork) pfe2(origmun)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo

acreg diffcaptures_f gold_shock_r mean_gold_shock_r c.time_t, id(id) time(year) spatial latitude(Latitude) longitude(Longitude) dist(150) pfe1(wartimenetwork) pfe2(origmun)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo

acreg diffcaptures_f gold_shock_r mean_gold_shock_r c.time_t, id(id) time(year) spatial latitude(Latitude) longitude(Longitude) dist(200) pfe1(wartimenetwork) pfe2(origmun)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo

esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA13_panelB.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep N, fmt(%12.4fc %12.0fc)) ///
	   keep(_nl_1) ///
	   varlabels( _nl_1 "Peer Effect") ///
	   replace	
	   
